package kr.hkit.androidcomplete03.ch23;

import kr.hkit.androidcomplete03.R;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

public class FrameAni extends Activity {
	AnimationDrawable mAni;
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.frameani);
		
		ImageView img = (ImageView) findViewById(R.id.babydrum);
		mAni = (AnimationDrawable) img.getBackground();
		
		img.post(new Runnable() {
			public void run() {
				mAni.start();
			}
		});
	}
	
	public void mOnClick(View v){
		switch(v.getId()){
		case R.id.start: mAni.start();
			break;
		case R.id.stop:	mAni.stop();
			break;
		}
	}
}
